#include "MouseObject.h"


MouseObject::MouseObject(void)
{
}


MouseObject::~MouseObject(void)
{
	SDL_FreeSurface(screen);
	SDL_Quit();
}

void MouseObject::run(){
	int terminar = 0;
const int WINDOW_WIDTH = 800;
	const int WINDOW_HEIGHT = 600;
	const char* WINDOW_TITLE = "Sample Mouse Movement";

	SDL_Init( SDL_INIT_VIDEO );

	screen = SDL_SetVideoMode( WINDOW_WIDTH, WINDOW_HEIGHT, 0, 
      SDL_HWSURFACE | SDL_DOUBLEBUF );
	SDL_WM_SetCaption( WINDOW_TITLE, 0 );

	rectangle.x = 20;
	rectangle.y = 20;
	int posicionRectanguloX = 20;
	int posicionRectanguloY = 20;
	rectangle.w = 100;
	rectangle.h = 80;

	  while(!terminar)
   {   

 	SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 251, 189, 74));
	rectangle.x=posicionRectanguloX;
 	rectangle.y=posicionRectanguloY;
	SDL_FillRect(screen, &rectangle, SDL_MapRGB(screen->format, 210, 55, 20));
	 	
   	SDL_Flip(screen);
	SDL_Event event;
	while ( SDL_PollEvent(&event) )
	{
		if (event.type == SDL_QUIT || event.key.keysym.sym ==
                  SDLK_ESCAPE)
		    terminar = 1;		
	}
	SDL_PumpEvents();
	if(SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(1)){
		SDL_GetMouseState(&posicionRectanguloX,&posicionRectanguloY);
	}
	}

   
}